<!--  验证码   -->
<template>
<div>
  <van-field  @input="change"
      v-model="code"
      center
      clearable
      label="短信验证码"
      placeholder="请输入短信验证码">
    <template #button>
      <van-button size="small" type="danger" @click="VerificationCode">发送验证码</van-button>
    </template>
  </van-field>

</div>
</template>

<script>
import {getVerificationCode} from "@/api/login-aip";

export default {
  name: "VerificationCode",
  data(){
    return{
      code:''
    }
  },
  props:{
    phonenumber:String
  },
  methods:{
    change(){
      this.$emit("getCode",this.code)
    },
    VerificationCode(){
      getVerificationCode(this.phonenumber).then((res)=>{
        console.log(res)

      })
    },
  }
}
</script>

<style scoped>

</style>